package com.yuch.service.impl;

import com.yuch.service.SendSMS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

//@Service
public class SendSMSImpl implements SendSMS {
    @Autowired
    private JavaMailSender javaMailSender;

    //发送人

    private String from ="3060186113@qq.com";
    //接收人
    private String to="ych4912@163.com";
    //标题
    private String title="测试标题";

    //正文
    private String context="测试右键正文 ";

    @Override
    public void sendsms() {
        SimpleMailMessage simpleMailMessage=new SimpleMailMessage();
        simpleMailMessage.setFrom(from);
        simpleMailMessage.setTo(to);
        simpleMailMessage.setSubject(title);
        simpleMailMessage.setText(context);
        javaMailSender.send(simpleMailMessage);
    }
}
